﻿using UnityEngine;
using System.Collections;

public class tiro : MonoBehaviour {
	public GameObject bala;
	public KeyCode triggerButton;
	public GameObject tiroposition;
	public float velx;
	public float vely;
	public static tiro instance;
	public float impulso;



	// Use this for initialization
	void Start () 
	{
		instance = this;
	}
	
	// Update is called once per frame
	void Update () 
	{
		if(Input.GetKeyDown(triggerButton))
		{
			GameObject b = Instantiate(bala, tiroposition.transform.position, Quaternion.identity) as GameObject;
			b.rigidbody2D.AddForce(new Vector2(velx, vely));
		}
	}
}
